<?php

namespace app\admin\controller;

use app\admin\logic\CommonMenuLogic;
use support\Request;
use support\Response;

/**
 * 合作企业菜单控制器
 */
class CompanyMenusController extends BaseController
{
    /**
     * 构造
     */
    public function __construct()
    {
        $this->logic = new CommonMenuLogic();
        parent::__construct();
    }

    /**
     * 数据列表
     * @param Request $request
     * @return Response
     */
    public function index(Request $request) : Response
    {
        $where = $request->more([]);
        $extWhere = [];
        $noBtns = $request->input('no_btns', 0);
        if ($noBtns) {
            $extWhere[] = ['menu_type', '<>', 2];
        }
        $data = $this->logic->tree($where, $extWhere);
        return $this->success($data);
    }
    
}
